package org.piwicode.bywordofmouth;

import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;

/**
 *
 * @author pierre
 */
public class BackboneImpl implements Backbone {

    private final AtomicReference<Share> share = new AtomicReference<>();

    public AtomicReference<Share> getShare() {
        return share;
    }

    @Override
    public List<Resource> getResources() {
        return share.get().resources();
    }

    @Override
    public Set<Hash> chunkHashSet() {
        return share.get().chunkHashSet();
    }

    @Override
    public List<Hash> getHashFor(Resource resource) {
        return share.get().getHashFor(resource);
    }

    @Override
    public byte[] getChunk(Hash hash) {
        return share.get().getChunk(hash);
    }
}
